<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="${ctx!}/assets/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="${ctx!}/assets/css/font-awesome.css?v=4.4.0" rel="stylesheet">

    <link href="${ctx!}/assets/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">

    <link href="${ctx!}/assets/css/animate.css" rel="stylesheet">
    <link href="${ctx!}/assets/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="${ctx!}/assets/css/admin-main.css" rel="stylesheet">
</head>
<body>

<div class="ibox-content" style="width: 600px;">
    <input type="hidden" id="id" name="id" value="${sysClass.id}">
    <div class="form-group">
        <label class="col-sm-3 control-label">分析类别名称：</label>
        <div class="col-sm-8">
            <input type="hidden" id="projectId" name="projectId" value="${project.id}">
            <input type="hidden" id="statisticsPowercostRateTypeId" name="id" value="${statisticsPowercostRateType.id}">
            <input style="width: 300px;margin-left: 50px;" id="name" name="name"
                   value="${statisticsPowercostRateType.name}"
                   class="form-control"
                   type="text">
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-10 col-sm-offset-3 btn-box">
            <button style="margin-left: 100px" class="btn btn-primary" type="button" onclick="submit()">确认</button>
            <button style="margin-left: 100px" class="btn btn-primary" onclick="back()" type="reset">取消</button>
        </div>
    </div>
</div>
</body>
<script src="${ctx!}/assets/js/jquery.min.js?v=2.1.4"></script>
<script src="${ctx!}/assets/js/bootstrap.min.js?v=3.3.6"></script>
<script src="${ctx!}/assets/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="${ctx!}/assets/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="${ctx!}/assets/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="${ctx!}/assets/js/plugins/peity/jquery.peity.min.js"></script>
<script src="${ctx!}/assets/js/plugins/layer/layer.min.js"></script>
<script src="${ctx!}/assets/js/content.js?v=1.0.0"></script>
<script>
    function submit() {
        if ($("#name").val().trim().length == 0) {
            layer.msg("分析类别名称不能为空")
            return false;
        }
        $.ajax({
            url: '${ctx!}/admin/statistics/config/statistics_powercost_rate_type/add_edit',
            method: 'POST',
            data: {
                name: $("#name").val().trim(),
                projectId: $("#projectId").val(),
                id: $("#statisticsPowercostRateTypeId").val(),
                level: 0
            },
            success: function (data) {
                data = eval('(' + data + ')')
                if (data.success) {
                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    parent.layer.close(index);
                    layer.msg(data.message)
                } else {
                    layer.msg(data.message)
                }
            }
        })
    }
</script>
</html>